package database;

import java.util.Objects;

public class CD extends Item{
    private String artist;
    private int trackNum;

    public CD(String title, String artist, int trackNum, int playingTime, boolean gotIt, String comment) {
        super(title, playingTime, gotIt, comment);
        this.artist = artist;
        this.trackNum = trackNum;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        CD cd = (CD) o;
        return trackNum == cd.trackNum && Objects.equals(artist, cd.artist);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), artist, trackNum);
    }

    @Override
    public void print() {
        System.out.print("CD: ");
        super.print();
        System.out.println(":" + artist);
    }
    public static void main(String[] args) {
        CD cd = new CD("Hello", "Hello", 1, 1, true, "Hello");
    }
}

